Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rapids-logger to generate the cuml logger #6162

Merged
merged 36 commits into from
Jan 3, 2025

Conversation

vyasr
Copy link
Contributor

@vyasr vyasr commented Dec 6, 2024

This PR replaces cuml's logger implementation with one generated using https://github.com/rapidsai/rapids-logger. This approach allows us to centralize the logger definition across different RAPIDS projects while allowing each project to vendor its own copy with a suitable set of macros and default logger objects. The common logger also takes care of handling the more complex packaging problems around ensuring that we fully isolate our spdlog dependency and do not leak any of its symbols, allowing our libraries to be safely installed in a much broader set of environments.

This PR requires rapidsai/rapids-logger#1

Contributes to rapidsai/build-planning#104

@vyasr vyasr added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 6, 2024
@vyasr vyasr self-assigned this Dec 6, 2024
Copy link

copy-pr-bot bot commented Dec 6, 2024

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions bot added the Cython / Python Cython or Python issue label Dec 6, 2024
@vyasr
Copy link
Contributor Author

vyasr commented Dec 7, 2024

/ok to test

1 similar comment
@vyasr
Copy link
Contributor Author

vyasr commented Dec 9, 2024

/ok to test

@vyasr
Copy link
Contributor Author

vyasr commented Dec 12, 2024

/ok to test

@vyasr
Copy link
Contributor Author

vyasr commented Dec 21, 2024

/ok to test

@vyasr
Copy link
Contributor Author

vyasr commented Dec 30, 2024

/ok to test

@@ -434,7 +435,18 @@ class UMAP(UniversalBase,
self.precomputed_knn = extract_knn_infos(precomputed_knn,
n_neighbors)

logger.set_level(verbose)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic was previously incorrect because it was propagating boolean verbosity values directly without accounting for the boolean handling done in Base's constructor.

@@ -44,7 +44,7 @@ class UMAP(BaseEstimator, DelayedTransformMixin):
>>> X, y = make_blobs(1000, 10, centers=42, cluster_std=0.1,
... dtype=np.float32, random_state=10)

>>> local_model = UMAP(random_state=10)
>>> local_model = UMAP(random_state=10, verbose=0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now must set this because the default logging level will result in an info log that was previously being incorrectly suppressed.

@vyasr vyasr marked this pull request as ready for review December 31, 2024 16:38
@vyasr vyasr requested review from a team as code owners December 31, 2024 16:38
@vyasr
Copy link
Contributor Author

vyasr commented Dec 31, 2024

The current failure should be fixed by rapidsai/rmm#1774. We're running into problems when building wheels because clones of rmm bring in the dated version of rapids-logger that was originally in that repository.

Copy link
Member

@dantegd dantegd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a couple of comments, besides that things look great!

Comment on lines +235 to +241
CPMAddPackage(
NAME rapids_logger GITHUB_REPOSITORY rapidsai/rapids-logger GIT_SHALLOW FALSE GIT_TAG
4df3ee70c6746fd1b6c0dc14209dae2e2d4378c6 VERSION 4df3ee70c6746fd1b6c0dc14209dae2e2d4378c6
)
rapids_make_logger(
ML EXPORT_SET cuml-exports LOGGER_HEADER_DIR include/cuml/common/ LOGGER_MACRO_PREFIX CUML LOGGER_TARGET cuml_logger
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this is something that happens in all repos that use rapids-logger, I wonder if a function in rapids-cmake would be a good idea instead of using CPMAddPackage directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes absolutely. Every repository will have to do its own call to rapids_make_logger to provide the right arguments, but I plan to replace the CPMAddPackage call with a rapids-cmake call. I will do that a bit later though once I'm ready to synchronize all the repos because right now they are using different commit hashes and I'll be adding a couple more features to the trunk of rapids-logger before I synchronize all the repos using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting to address this in rapidsai/rapids-cmake#737.

@@ -195,10 +138,16 @@ def set_pattern(pattern):
pattern for a code section, as described in the example section above.
"""
IF GPUBUILD == 1:
cdef string prev = Logger.get().getPattern()
context_object = PatternSetter(prev.decode("UTF-8"))
# TODO: We probably can't implement this exact API because you can't
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a github issue to track this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vyasr vyasr requested a review from dantegd January 3, 2025 00:31
@dantegd
Copy link
Member

dantegd commented Jan 3, 2025

/merge

@rapids-bot rapids-bot bot merged commit 51e6851 into rapidsai:branch-25.02 Jan 3, 2025
65 checks passed
@vyasr vyasr deleted the feat/logger branch January 3, 2025 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake CUDA/C++ Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants